type Replace<
  // 传入的字符串
  T extends string,
  // 要被替换的字符串
  C extends string,
  // 要替换的字符串
  RC extends string,
  // 要返回的字符
  F extends string = ""
> = C extends ""
  ? T extends ""
    ? RC
    : `${RC}${T}` // 先处理特殊情况 type a4 = Replace<"", "", "jiangwen">;
  : T extends `${infer L}${C}${infer R}` // 根据分隔符来进行替换
  ? Replace<R, C, RC, `${F}${L}${RC}`> // 将剩余部分继续替换
  : `${F}${T}`; // 追加剩余

// replace 字符串 ， 匹配哪个字符 换成哪一个
type a1 = Replace<"111ha ha ha 123", "ha", "he">;
type a2 = Replace<"jw", "jw", "jiangwen">;
type a3 = Replace<"a", "", "jiangwen">;
type a4 = Replace<"", "", "jiangwen">;

export {};
